﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

using DotNetWarcraft.WoWGuildRoster.Business;

namespace DotNetWarcraft.WoWGuildRoster.Data {

  public interface IRepository<T> where T : class {
    /// <summary>
    /// Return all instances of type T.
    /// </summary>
    /// <returns></returns>
    T[] All();

    /// <summary>
    /// Return all instances of type T that match the expression exp.
    /// </summary>
    /// <param name="exp"></param>
    /// <returns></returns>
    T[] FindAll(Func<T, bool> exp);

    /// <summary>
    /// Return instance of type T with the passed ID.
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    T Find(int id);

    /// <summary>
    /// Mark an entity to be deleted.
    /// </summary>
    /// <param name="entity">Entity to delete</param>
    void Delete(T entity);

    /// <summary>Persist the data context.</summary>
    /// <param name="entity">Entity to save</param>
    int Save(T entity);
  }

  public interface IGuildEntryStatRepository<T> where T : class {
    /// <summary>
    /// Return instance of type T with the passed ID.
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    T[] Find_ByChar(int id);

    /// <summary>
    /// Return instance of type T with the passed ID.
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    T[] Find_ByEntryAndType(String entryName, int statType);
  }

}
